home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / DeathFizzle.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.9 KB  |  86 lines

  1. class classes.shots.DeathFizzle
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var clip;
  7.    var cMax;
  8.    var cv;
  9.    var speed;
  10.    var xMov = 0;
  11.    var yMov = 0;
  12.    var xMovT = 0;
  13.    var yMovT = 0;
  14.    var c = 0;
  15.    var yank = false;
  16.    var power = 15;
  17.    var Name = "deathFizzle";
  18.    function DeathFizzle(px, py, pid)
  19.    {
  20.       this.x = px;
  21.       this.y = py;
  22.       this.id = pid;
  23.       _root.d = _root.d + 1;
  24.       this.clip = _root.attachMovie("deathFizzle","deathFizzle" + this.id + "Clip",_root.d);
  25.       this.clip._x = this.x;
  26.       this.clip._y = this.y;
  27.       this.cMax = _root.randRange(150,250);
  28.       this.cv = 1;
  29.       this.speed = 4;
  30.       this.speed *= _root.dif.speed;
  31.    }
  32.    function main()
  33.    {
  34.       this.c = this.c + 1;
  35.       var _loc3_ = _root.getAngleRad(this.x,this.y);
  36.       this.xMovT = Math.cos(_loc3_) * this.speed;
  37.       this.yMovT = Math.sin(_loc3_) * this.speed;
  38.       this.speed += 0.1;
  39.       this.cv -= 0.02;
  40.       if(this.cv < 0.1)
  41.       {
  42.          this.cv = 0.1;
  43.       }
  44.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  45.       {
  46.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  47.       }
  48.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  49.       {
  50.          this.yank = true;
  51.       }
  52.       if(this.xMovT < this.xMov)
  53.       {
  54.          this.xMov -= this.cv;
  55.       }
  56.       else if(this.xMovT > this.xMov)
  57.       {
  58.          this.xMov += this.cv;
  59.       }
  60.       else
  61.       {
  62.          this.xMov = this.xMovT;
  63.       }
  64.       if(this.yMovT < this.yMov)
  65.       {
  66.          this.yMov -= this.cv;
  67.       }
  68.       else if(this.yMovT > this.yMov)
  69.       {
  70.          this.yMov += this.cv;
  71.       }
  72.       else
  73.       {
  74.          this.yMov = this.yMovT;
  75.       }
  76.       this.x += this.xMov;
  77.       this.y += this.yMov;
  78.       if(this.yank)
  79.       {
  80.          _root.removeEnemyShot("deathFizzle" + this.id);
  81.       }
  82.       this.clip._x = this.x;
  83.       this.clip._y = this.y;
  84.    }
  85. }
  86.